Operating Systems

Two main purposes:

Common general-purpose OSs:

Embedded operating systems exist in home appliances, TV boxes, game consoles, etc.

The four essential managers of every operating system:

Each manager must perform certain tasks:

Processes & Programs

A program is the code that performs some task (algorithm, etc.)

OS Structure

System Boot (Initialisation)

When the device is turned on:

The ROM contains a small bootstrap program:

Kernel performs further setup and system checks

Command Interpreter (Shell)

The shell is a collection of processes that are spawned by the kernel

Before:

Protection Levels

The kernel has access to all parts of the CPU, every component, and every I/O device

For Intel x86:

Certain registers, instructions, and memory addresses are protected

Processor Manager

The processor manager decides how to allocate the CPU to waiting processes

Multiprogramming

Early OSs facilitated multiprogramming

Multitasking (Time sharing)

This extends the concept of multiprogramming by providing fair access to the CPU

Interrupt Handling

Multitasking depends on the ability to interrupt the CPU at regular intervals

Context Switch

The clock interrupt is triggered at the end of each time slice (quantum)

Process Control Block (PCB)

The kernel maintains a PCB for every process

Process States

A process goes through many state changes during its lifetime
OS must keep track and update PCB accordingly

![[Pasted image 20250516102502.png]]